package com.health.mapp.impl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import com.health.db.dto.DoctorListDto;
import com.health.db.service.user.IUserCollectFavoriteService;
import com.health.mapp.bean.Header;
import com.health.mapp.bean.QueryCollectionDocReq;
import com.health.mapp.bean.QueryCollectionDocResp;
import com.health.mapp.utils.Response;

/**
 * Created by helili on 2017/2/20.
 */
public class QueryCollectionDocImpl implements ActionInterface {
    private Logger logger = Logger.getLogger(QueryCollectionDocImpl.class);
    private IUserCollectFavoriteService userCollectFavoriteService  ;
    @Override
    public Response execute(Header header, Object reqBean) throws Exception {
        QueryCollectionDocReq req = (QueryCollectionDocReq) reqBean;
        QueryCollectionDocResp resp = new QueryCollectionDocResp();
        String userId= req.getUserId();
        if(StringUtils.isEmpty(userId)){
            resp.setErrorMsg("用户ID不能为空");
            resp.setErrorCode(-1);
            return resp;
        }
        List<DoctorListDto> collectFavoriteList= userCollectFavoriteService.selectDocListDtoByCollectorId(Long.parseLong(userId));
        resp.setDocList(collectFavoriteList);
        return resp;
    }
	public IUserCollectFavoriteService getUserCollectFavoriteService() {
		return userCollectFavoriteService;
	}
	public void setUserCollectFavoriteService(
			IUserCollectFavoriteService userCollectFavoriteService) {
		this.userCollectFavoriteService = userCollectFavoriteService;
	}
    
    
}
